[IA64] use page_list_head and related stuff.
authorIsaku Yamahata <yamahata@valinux.co.jp>
Fri, 13 Feb 2009 02:22:59 +0000 (11:22 +0900)
committerIsaku Yamahata <yamahata@valinux.co.jp>
Fri, 13 Feb 2009 02:22:59 +0000 (11:22 +0900)
Use page_list_head and stuff for consistency with x86 code.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/arch/ia64/xen/domain.c
xen/arch/ia64/xen/mm.c
xen/arch/ia64/xen/tlb_track.c
xen/include/asm-ia64/domain.h
xen/include/asm-ia64/mm.h
xen/include/asm-ia64/tlb_track.h

index b22304a1bb8579a65196ee9f3d59842ba0005cf8..2cf4a556669785c5c4ae1f7c9c28b5896bf5b090 100644 (file)
@@ -608,7 +608,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
        memset(&d->arch.mm, 0, sizeof(d->arch.mm));
        d->arch.relres = RELRES_not_started;
        d->arch.mm_teardown_offset = 0;
-       INIT_LIST_HEAD(&d->arch.relmem_list);
+       INIT_PAGE_LIST_HEAD(&d->arch.relmem_list);
 
        if ((d->arch.mm.pgd = pgd_alloc(&d->arch.mm)) == NULL)
            goto fail_nomem;
@@ -1626,9 +1626,8 @@ int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_u c)
        return rc;
 }
 
-static int relinquish_memory(struct domain *d, struct list_head *list)
+static int relinquish_memory(struct domain *d, struct page_list_head *list)
 {
-    struct list_head *ent;
     struct page_info *page;
 #ifndef __ia64__
     unsigned long     x, y;
@@ -1637,16 +1636,14 @@ static int relinquish_memory(struct domain *d, struct list_head *list)
 
     /* Use a recursive lock, as we may enter 'free_domheap_page'. */
     spin_lock_recursive(&d->page_alloc_lock);
-    ent = list->next;
-    while ( ent != list )
+
+    while ( (page = page_list_remove_head(list)) )
     {
-        page = list_entry(ent, struct page_info, list);
         /* Grab a reference to the page so it won't disappear from under us. */
         if ( unlikely(!get_page(page, d)) )
         {
             /* Couldn't get a reference -- someone is freeing this page. */
-            ent = ent->next;
-            list_move_tail(&page->list, &d->arch.relmem_list);
+            page_list_add_tail(page, &d->arch.relmem_list);
             continue;
         }
 
@@ -1681,9 +1678,8 @@ static int relinquish_memory(struct domain *d, struct list_head *list)
 #endif
 
         /* Follow the list chain and /then/ potentially free the page. */
-        ent = ent->next;
         BUG_ON(get_gpfn_from_mfn(page_to_mfn(page)) != INVALID_M2P_ENTRY);
-        list_move_tail(&page->list, &d->arch.relmem_list);
+        page_list_add_tail(page, &d->arch.relmem_list);
         put_page(page);
 
         if (hypercall_preempt_check()) {
@@ -1692,7 +1688,13 @@ static int relinquish_memory(struct domain *d, struct list_head *list)
         }
     }
 
-    list_splice_init(&d->arch.relmem_list, list);
+    /* list is empty at this point. */
+    if ( !page_list_empty(&d->arch.relmem_list) )
+    {
+        *list = d->arch.relmem_list;
+        INIT_PAGE_LIST_HEAD(&d->arch.relmem_list);
+    }
+
 
  out:
     spin_unlock_recursive(&d->page_alloc_lock);
index 0b7c4a2aac498670d82c22fe989e76e4bf242812..97deeddfe8cdca5d49b2d35222afebf3d2f4e921 100644 (file)
@@ -474,7 +474,7 @@ share_xen_page_with_guest(struct page_info *page,
         page->count_info |= PGC_allocated | 1;
         if ( unlikely(d->xenheap_pages++ == 0) )
             get_knownalive_domain(d);
-        list_add_tail(&page->list, &d->xenpage_list);
+        page_list_add_tail(page, &d->xenpage_list);
     }
 
     // grant_table_destroy() releases these pages.
@@ -2856,7 +2856,7 @@ steal_page(struct domain *d, struct page_info *page, unsigned int memflags)
     /* Unlink from original owner. */
     if ( !(memflags & MEMF_no_refcount) )
         d->tot_pages--;
-    list_del(&page->list);
+    page_list_del(page, &d->page_list);
 
     spin_unlock(&d->page_alloc_lock);
     perfc_incr(steal_page);
index d9e30a2db561b62cedd5b63c5feaaa84c0fbd5c4..d400359233f309754614d18fb9b636a99e8c0db7 100644 (file)
@@ -56,7 +56,7 @@ tlb_track_allocate_entries(struct tlb_track* tlb_track)
         return -ENOMEM;
     }
 
-    list_add(&entry_page->list, &tlb_track->page_list);
+    page_list_add(entry_page, &tlb_track->page_list);
     track_entries = (struct tlb_track_entry*)page_to_virt(entry_page);
     allocated = PAGE_SIZE / sizeof(track_entries[0]);
     tlb_track->num_entries += allocated;
@@ -93,7 +93,7 @@ tlb_track_create(struct domain* d)
     tlb_track->limit = TLB_TRACK_LIMIT_ENTRIES;
     tlb_track->num_entries = 0;
     tlb_track->num_free = 0;
-    INIT_LIST_HEAD(&tlb_track->page_list);
+    INIT_PAGE_LIST_HEAD(&tlb_track->page_list);
     if (tlb_track_allocate_entries(tlb_track) < 0)
         goto out;
 
@@ -136,8 +136,8 @@ tlb_track_destroy(struct domain* d)
     spin_lock(&tlb_track->free_list_lock);
     BUG_ON(tlb_track->num_free != tlb_track->num_entries);
 
-    list_for_each_entry_safe(page, next, &tlb_track->page_list, list) {
-        list_del(&page->list);
+    page_list_for_each_safe(page, next, &tlb_track->page_list) {
+        page_list_del(page, &tlb_track->page_list);
         free_domheap_page(page);
     }
 
index 4f4afdb0cdf86b00165c4092142806669d3e1d3c..d181b5f826ea5abf7a58460497a7c2b78e2827b2 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/vmx_platform.h>
 #include <xen/list.h>
 #include <xen/cpumask.h>
+#include <xen/mm.h>
 #include <asm/fpswa.h>
 #include <xen/rangeset.h>
 
@@ -224,7 +225,7 @@ struct arch_domain {
     /* Continuable mm_teardown() */
     unsigned long mm_teardown_offset;
     /* Continuable domain_relinquish_resources() */
-    struct list_head relmem_list;
+    struct page_list_head relmem_list;
 };
 #define INT_ENABLE_OFFSET(v)             \
     (sizeof(vcpu_info_t) * (v)->vcpu_id + \
index 5d35304f7d8fe5765b5d04b185ee667069292bb0..afd65d61ff7b6c63a05488212c7cad0fbc36b4fc 100644 (file)
@@ -39,10 +39,23 @@ typedef unsigned long page_flags_t;
 
 #define PRtype_info "016lx"
 
+#if 0
+/*
+ * See include/xen/mm.h.
+ * For now, abandon to compress struct page_info
+ * seeing IA64_MAX_PHYS_BITS and page size.
+ */
+#undef page_list_entry
+struct page_list_entry
+{
+    unsigned long next, prev;
+};
+#endif
+
 struct page_info
 {
     /* Each frame can be threaded onto a doubly-linked list. */
-    struct list_head list;
+    struct page_list_entry list;
 
     /* Reference count and various PGC_xxx flags and fields. */
     unsigned long count_info;
index 82d55b744953afa461d23adff58f329658fe8802..503e7ef4cd1ec164aeb8cbdcb50c4999cee442f8 100644 (file)
@@ -72,7 +72,7 @@ struct tlb_track {
     unsigned int                limit;
     unsigned int                num_entries;
     unsigned int                num_free;
-    struct list_head            page_list;
+    struct page_list_head       page_list;
 
     /* XXX hash table size */
     spinlock_t                  hash_lock;